
********************************************************************************************************************************
						
														***Marlene Mauk, Max Groemping***
			***Online Disinformation Predicts Inaccurate Beliefs about Election Fairness among Winners and Losers***
											***Replication File  ##5 - VALIDATION AND DESCRIPTIVES 2***
						
********************************************************************************************************************************


** validation of disinformation measure (cont'd)
*individual-level social media use (Figures D2.1, D2.2)
clear all
import delimited xaxis pei1 pei1_low pei1_high using ".\mplus\d1_model5a_sm1.dat", delimiter(tab, collapse) varnames(nonames) 
destring xaxis pei1 pei1_low pei1_high, force replace
save model5_high.dta, replace
clear
import delimited xaxis pei1alt pei1alt_low pei1alt_high using ".\mplus\d1_model5a_sm0.dat", delimiter(tab, collapse) varnames(nonames) 
destring xaxis pei1alt pei1alt_low pei1alt_high, force replace
gen yline = 0
save model5_low.dta, replace
append using model5_high.dta
twoway ///
(pci 0 0 0 1, lc(cranberry)) ///
(line yline xaxis, lp(solid) lc(cranberry) lwidth(0.1)) ///
(line pei1 xaxis, lp(solid) lc(black)) ///
(line pei1_high xaxis, lp(solid) lc(black) lwidth(0.1)) ///
(line pei1_low xaxis, lp(solid) lc(black) lwidth(0.1)) ///
(line pei1alt_high xaxis, lp(dash) lc(gs9) lwidth(0.1)) ///
(line pei1alt_low xaxis, lp(dash) lc(gs9) lwidth(0.1)) ///
(line pei1alt xaxis, lp(dash) lc(gs9)), ///
graphregion(color(white)) legend(region(lp(blank))) ///	
ytitle("effects of electoral integrity on public perceptions of fairness", size(small)) yline(0) ///
xtitle("online disinformation, for social media users (solid line) and non-users (dashed line)", size(small)) xlabel(0(0.1)1) ///
graphregion(color(white)) legend(region(lp(blank))) ///
legend(off)
graph export .\figures\figured2_1.png, replace 

clear all
import delimited xaxis pei1 pei1_low pei1_high using ".\mplus\d1_model5b_sm1.dat", delimiter(tab, collapse) varnames(nonames) 
destring xaxis pei1 pei1_low pei1_high, force replace
save model5_high.dta, replace
clear
import delimited xaxis pei1alt pei1alt_low pei1alt_high using ".\mplus\d1_model5b_sm0.dat", delimiter(tab, collapse) varnames(nonames) 
destring xaxis pei1alt pei1alt_low pei1alt_high, force replace
gen yline = 0
save model5_low.dta, replace
append using model5_high.dta
twoway ///
(pci 0 0 0 1, lc(cranberry)) ///
(line yline xaxis, lp(solid) lc(cranberry) lwidth(0.1)) ///
(line pei1 xaxis, lp(solid) lc(black)) ///
(line pei1_high xaxis, lp(solid) lc(black) lwidth(0.1)) ///
(line pei1_low xaxis, lp(solid) lc(black) lwidth(0.1)) ///
(line pei1alt_high xaxis, lp(dash) lc(gs9) lwidth(0.1)) ///
(line pei1alt_low xaxis, lp(dash) lc(gs9) lwidth(0.1)) ///
(line pei1alt xaxis, lp(dash) lc(gs9)), ///
graphregion(color(white)) legend(region(lp(blank))) ///	
ytitle("effects of electoral integrity on public perceptions of fairness", size(small)) yline(0) ///
xtitle("online disinformation, for social media powerusers (solid line) and non-powerusers (dashed line)", size(small)) xlabel(0(0.1)1) ///
graphregion(color(white)) legend(region(lp(blank))) ///
legend(off)
graph export .\figures\figured2_2.png, replace 


*nature and prevalence of disinformation in different types of regimes (Figure D3)
clear
use mergeddata.dta
collapse democracy disinfo01 v2smgovdom v2smfordom v2smpardom, by(elecow)
ttest disinfo01, by(democracy)
scatter disinfo01 democracy, graphregion(color(white)) jitter(25) xtitle(" ") ytitle("disinformation index") mstyle(p5) msize(medium) msymbol(plus) xlabel(0 "autocracies" 1 "democracies") xscale(range(-0.2 1.2)) yscale(range(0 1)) ylabel(0 0.2 0.4 0.6 0.8 1, format(%9.1gc)) name(plot1)
scatter v2smgovdom democracy, graphregion(color(white)) jitter(25) xtitle(" ") ytitle("government disinformation") mstyle(p5) msize(medium) msymbol(plus) xlabel(0 "autocracies" 1 "democracies") xscale(range(-0.2 1.2)) yscale(range(0 1)) ylabel(0 0.2 0.4 0.6 0.8 1, format(%9.1gc)) name(plot2)
scatter v2smfordom democracy, graphregion(color(white)) jitter(25) xtitle(" ") ytitle("foreign disinformation") mstyle(p5) msize(medium) msymbol(plus) xlabel(0 "autocracies" 1 "democracies") xscale(range(-0.2 1.2)) yscale(range(0 1)) ylabel(0 0.2 0.4 0.6 0.8 1, format(%9.1gc)) name(plot3)
scatter v2smpardom democracy, graphregion(color(white)) jitter(25) xtitle(" ") ytitle("partisan disinformation") mstyle(p5) msize(medium) msymbol(plus) xlabel(0 "autocracies" 1 "democracies") xscale(range(-0.2 1.2)) yscale(range(0 1)) ylabel(0 0.2 0.4 0.6 0.8 1, format(%9.1gc)) name(plot4)
graph combine plot1 plot2 plot3 plot4, rows(2) graphregion(color(white))
graph export .\figures\figured3.png, replace
clear


** Appendix E: checking for multicollinearity (Table E1)
use mergeddata.dta
drop if winner==.
quietly: regress pef01 polint soctrust satdem income age edu_2 edu_3 winner pei01 disinfo01 v2xme_altinf dommonrestr gdpgrowth internet v2eltrnout v2elaccept intmonrestr democracy
vif
quietly: regress pef01 polint soctrust satdem income age edu_2 edu_3 winner pei01 disinfo01 v2xme_altinf gdpgrowth internet v2eltrnout v2elaccept democracy
vif
clear

** Appendix F: descriptives (Table F1)
use mergeddata.dta
sum pef01 winner polint soctrust satdem income age edu_1 edu_2 edu_3
collapse pei01 disinfo01 gdpgrowth internet v2xme_altinf dommonrestr intmonrestr v2eltrnout v2elaccept democracy, by(elecow)
sum pei01 disinfo01 gdpgrowth internet v2xme_altinf dommonrestr intmonrestr v2eltrnout v2elaccept democracy
clear